package com.basic;

import com.frame.struts.BaseBean;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import com.utils.CommUtil;
import javax.servlet.http.HttpServletResponse;
import com.frame.struts.ActionContext;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2006</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class MainSaleCommodityRegionForm extends BaseBean {
    public MainSaleCommodityRegionForm() {
    }


	MainSaleCommodityRegionEntity mscr = new MainSaleCommodityRegionEntity();

		public String addMainSaleCommodityRegion() {
			HttpServletRequest request = ActionContext.getActionContext().
				getRequest();
			HttpServletResponse response = ActionContext.getActionContext().
				getResponse();
			BasicFactory factory = new BasicFactory();
			//String qyid = (String) request.getSession().getAttribute("session_qyid");
			//mscr.setSpid(qyid);
			mscr.setOptdate(new Date());
			mscr.setOptrid(CommUtil.getUserId(request));
			try{
		if(factory.addMainSaleCommodityRegion(mscr)){
			//System.out.println("wo zhi xing le!");
				response.sendRedirect("/basic/queryMainSaleCommodityRegion.jsp?spid="+mscr.getSpid());
				return "success";
		}
		response.sendRedirect("/basic/failed.jsp");
		}
		catch (Exception e) {

		}

			return "11";

		}

		public String modifyMainSaleCommodityRegion(){
				HttpServletRequest request = ActionContext.getActionContext().
					getRequest();
				HttpServletResponse response = ActionContext.getActionContext().
					getResponse();
				BasicFactory factory = new BasicFactory();
		//		String qyid = (String) request.getSession().getAttribute("session_qyid");
		//		mscr.setQyid(qyid);
				mscr.setOptdate(new Date());
				mscr.setOptrid(CommUtil.getUserId(request));
				factory.deleteMainSaleCommodityRegion(mscr.getSpid(),mscr.getQymc());
				try{
				 if(factory.addMainSaleCommodityRegion(mscr)){
					 //System.out.println("wo zhi xing le!");
						 response.sendRedirect("/basic/queryMainSaleCommodityRegion.jsp?spid="+mscr.getSpid());
						 return "success";
				 }
				 response.sendRedirect("/basic/failed.jsp");
				 }
				 catch (Exception e) {

				 }

				 return "11";

			}


			/**
			 * @return Returns the gjzyl.
			 */
			public double getGjzyl() {
				return mscr.getGjzyl();
			}
			/**
			 * @param gjzyl The gjzyl to set.
			 */
			public void setGjzyl(double gjzyl) {
				mscr.setGjzyl(gjzyl);
			}
			/**
			 * @return mscr. return mscr.s the khq.
			 */
			public String getKhq() {
				return mscr.getKhq();
			}
			/**
			 * @param khq The khq to set.
			 */
			public void setKhq(String khq) {
				mscr.setKhq(khq);
			}
			/**
			 * @return mscr. return mscr.s the optdate.
			 */
			public Date getOptdate() {
				return mscr.getOptdate();
			}
			/**
			 * @param optdate The optdate to set.
			 */
			public void setOptdate(Date optdate) {
				mscr.setOptdate(optdate);
			}
			/**
			 * @return mscr. return mscr.s the optrid.
			 */
			public String getOptrid() {
				return mscr.getOptrid();
			}
			/**
			 * @param optrid The optrid to set.
			 */
			public void setOptrid(String optrid) {
				mscr.setOptrid(optrid);
			}
			/**
			 * @return mscr. return mscr.s the qymc.
			 */
			public String getQymc() {
				return mscr.getQymc();
			}
			/**
			 * @param qymc The qymc to set.
			 */
			public void setQymc(String qymc) {
				mscr.setQymc(qymc);
			}
			/**
			 * @return mscr. return mscr.s the qyxse.
			 */
			public double getQyxse() {
				return mscr.getQyxse();
			}
			/**
			 * @param qyxse The qyxse to set.
			 */
			public void setQyxse(double qyxse) {
				mscr.setQyxse(qyxse);
			}
			/**
			 * @return mscr. return mscr.s the recstate.
			 */
			public String getRecstate() {
				return mscr.getRecstate();
			}
			/**
			 * @param recstate The recstate to set.
			 */
			public void setRecstate(String recstate) {
				mscr.setRecstate(recstate);
			}
			/**
			 * @return mscr. return mscr.s the remark.
			 */
			public String getRemark() {
				return mscr.getRemark();
			}
			/**
			 * @param remark The remark to set.
			 */
			public void setRemark(String remark) {
				mscr.setRemark(remark);
			}
				/**
				 * @return mscr. return mscr.s the spid.
				 */
				public int getSpid() {
					return mscr.getSpid();
				}
				/**
				 * @param spid The spid to set.
				 */
				public void setSpid(int spid) {
					mscr.setSpid(spid);
				}

}